home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / AppsToGo / AppsToGo.src / DTS.Draw / TreeObj2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-18  |  2.3 KB  |  103 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TreeObj2.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  20. #include "App.protos.h"        /* Get the prototypes for the application.        */
  21.  
  22. #ifndef __TREEOBJ2__
  23. #include "TreeObj2.h"
  24. #endif
  25.  
  26. extern TreeObjProcPtr    gTreeObjMethods[];
  27.  
  28.  
  29.  
  30. /**********************************************************************/
  31.  
  32.  
  33.  
  34. #pragma segment File
  35. TreeObjHndl    DoTreeHitTest(TreeObjHndl hndl, ClickInfo *click)
  36. {
  37.     short        cnum;
  38.     TreeObjHndl    hit;
  39.  
  40.     if (hit = (TreeObjHndl)DoTreeObjMethod(hndl, HITTESTMESSAGE, (long)click)) return(hit);
  41.  
  42.     for (cnum = 0; cnum < (*hndl)->numChildren; ++cnum)
  43.         if (hit = DoTreeHitTest(GetChildHndl(hndl, cnum), click)) return(hit);
  44.  
  45.     return(nil);
  46. }
  47.  
  48.  
  49.  
  50. /**********************************************************************/
  51.  
  52.  
  53.  
  54. #pragma segment File
  55. void    DoTreeDraw(TreeObjHndl hndl, short drawType)
  56. {
  57.     DoBTreeMethod(hndl, DRAWMESSAGE, drawType);
  58. }
  59.  
  60.  
  61.  
  62. /**********************************************************************/
  63.  
  64.  
  65.  
  66. #pragma segment File
  67. void    DoTreeSelect(TreeObjHndl hndl, short selectType)
  68. {
  69.     FileRecHndl    frHndl;
  70.     WindowPtr    window;
  71.  
  72.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  73.     BeginContent(window = (*frHndl)->fileState.window);
  74.     DoFTreeMethod(hndl, SETSELECTMESSAGE, selectType);
  75.     EndContent(window);
  76. }
  77.  
  78.  
  79.  
  80. /**********************************************************************/
  81.  
  82.  
  83.  
  84. #pragma segment File
  85. long    DoTreeObjMethodClipped(TreeObjHndl hndl, short message, long data)
  86. {
  87.     FileRecHndl    frHndl;
  88.     WindowPtr    window;
  89.     long        val;
  90.  
  91.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  92.     BeginContent(window = (*frHndl)->fileState.window);
  93.  
  94.     val = DoTreeObjMethod(hndl, message, data);
  95.  
  96.     EndContent(window);
  97.  
  98.     return(val);
  99. }
  100.  
  101.  
  102.  
  103.